//声明保存用户的Key
const userKey = 'erpuser';

//保存用户信息
export function setUser(data){
    localStorage.setItem(userKey,JSON.stringify(data));

}

//返回用户信息
export function getUser(){
    let user = localStorage.getItem(userKey);
    if(user){  //如果存在
        user= JSON.parse(user);
    }else{
        user = null;
    }
    return user;
}

export function logout(){
    localStorage.removeItem(userKey);
}